package struts.form;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

import struts.action.ActionForm;

public class FullForm {
	
	public FullForm(){
		
	}
	
	public static ActionForm full(String formClass,HttpServletRequest request){
		ActionForm o = null;
		try{
			Class clazz = Class.forName(formClass);
			o = (ActionForm) clazz.newInstance();
			Field[] f_ar = clazz.getDeclaredFields();
			for(Field f:f_ar){
				f.setAccessible(true);
				f.set(o, request.getParameter(f.getName()));
				f.setAccessible(false);
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return o;
	}
}
